Coder matched layer separation for compression of compound documents

ABSTRACT

Methods for decomposing compound documents for mixed raster content representation are provided. A method for decomposing an image includes the step of decomposing the image into a plurality of stripes. Each stripe is decomposed into foreground, background, and mask layers. The layers are interpolated to modify values of irrelevant pixels in order to achieve more efficient compression. The layers may subsequently be compressed with a coder.

FIELD OF THE INVENTION

This invention relates to the field of data compression. In particular,this invention is drawn to representation and compression of compounddocuments.

BACKGROUND OF THE INVENTION

Compound documents may include color images, text, and graphics. Mixedraster content (MRC) is an International Telecommunication Unionstandard (ITU T.44 04/1999) that specifies a method for efficientrepresentation of a compound document as a union of multiple layers. MRCalso specifies methods for compressing the document using pre-determinedencoders for the individual layers.

Although the ITU T.44 standard sets forth methods for efficientrepresentation of the document once the layers are identified, thestandard does not address decomposition of an MRC document into theindividual layers. The decomposition approach, however, may have asignificant influence on the compressibility of the resulting layers andthus the size of the compressed document. Thus although numerousdistinct decompositions of the document may exist, they will not allyield the same level of compression. Trying each decomposition toidentify the one with the optimal rate and quality is intractable.

SUMMARY OF THE INVENTION

In view of limitations of known systems and methods, methods andapparatus for decomposing compound documents for mixed raster contentrepresentation and compression are provided.

A method for decomposing an image includes the step of decomposing theimage into a plurality of stripes. Each stripe is decomposed intoforeground, background, and mask layers. The layers are interpolated tomodify values of irrelevant pixels in order to achieve more efficientcompression. The layers may subsequently be compressed with the coder.

In one embodiment, a perimeter finding function is used with a commonarea reduction function to identify a base color for each layer andoffsets to common reduced areas thus effectively separating the stripeinto foreground and background layers for all regions except where theforeground and background common reduced areas overlap. A coder matchedlayer separation process is applied to the overlapped common reducedarea to separate it into the foreground and background layers beforeinterpolation.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is illustrated by way of example and notlimitation in the figures of the accompanying drawings, in which likereferences indicate similar elements and in which:

FIG. 1 illustrates a multilayer representation of a compound document.

FIG. 2 illustrates stripe decomposition of the compound document.

FIG. 3 illustrates coded foreground and background layers of a stripe.

FIG. 4 illustrates one embodiment of an MRC coder process including thestripe analysis process.

FIG. 5 illustrates the perimeter finding function.

FIG. 6 illustrates one embodiment of the common area reduction function.

FIG. 7 illustrates a stripe with a common area decomposed intoforeground and background layers after common area reduction.

FIGS. 8–9 illustrate the coder matched layer separation process.

FIG. 10 illustrates the selection of blocks for pixel interpolation ormodification.

FIG. 11 illustrates one embodiment of a block oriented compressionprocess.

FIG. 12 illustrates a zig-zag processing order for entropy encodingcoefficients.

FIG. 13 illustrates a method of modifying the spectral content of aselected block of pixels subject to a plurality of constraints.

DETAILED DESCRIPTION

In one embodiment MRC represents a compound document 110 using threelayers (background 130, foreground 120, and mask 140) as illustrated inFIG. 1. The background and foreground are image layers and the masklayer is binary (i.e., 1 bit per pixel). Once represented as layers, thedocument may be compressed. The background and foreground layers may beencoded at a lower resolution than the original, but the mask is alwayscoded in a lossless manner at full resolution. The three layer model maybe extended to N layers by adding layers in (image, mask) pairs.

To reconstruct the original document, the background and foregroundlayers are reconstructed from their corresponding compressed layer data.The mask identifies whether a pixel of the reconstructed document is tobe provided by the reconstructed background or the reconstructedforeground layers.

The standard supports the use of JPEG (Joint Photographic Experts Group)or JBIG (Joint Bilevel Image Experts Group) compression for theforeground and background image layers. The standard supports Group 3(G3), Group 4 (G4), and JBIG compression for the mask layer.

MRC supports coding the document as a series of stripes. FIG. 2illustrates stripe decomposition of a compound document 210. Thedocument is striped for analysis. The stripes of the striped document220 are analyzed and decomposed in block 230. The background 236,foreground 238, and mask 234 data for each stripe as well as stripeparameters 232 are encapsulated in the MRC bit stream 240 as stripe data242. The MRC standard does not address the specifics of the analysis ordecomposition provided by block 230.

One goal of the decomposition process is to obtain a new optimaldecomposition in terms of compactness of the coded bitstream and qualityof the reconstructed image while staying within a reasonable complexityconstraint. Optimization of the coded bitstream requires considerationof the characteristics of the encoders applied to the individual layerdata. In the illustrated embodiment, block 230 uses JPEG to encode theforeground and background layers and thus must consider the particularsof the JPEG coder when determining how stripes should be decomposed intothe individual layers for compression.

The MRC syntax permits a set of parameters to be transmitted for eachstripe. These parameters include spatial offsets and sizes to define thesize and position of the coded foreground and background layers. Theforeground and background layers may be smaller than the stripe. Themask layer, however, is always full resolution and full size.

FIG. 3 illustrates a stripe 310 having coded foreground 320 andbackground 330 layers that are smaller than the stripe. Two parametersrepresent the foreground and background base color that are used to fillup the foreground and background layers in portions 322 and 332,respectively, outside the coded regions specified by the offset and sizeparameters.

Once the mask is derived, both the foreground and background layers have“holes” or “don't care pixels” corresponding to pixels that belong tothe other layer as determined by the mask. Thus whenever the maskindicates that a particular pixel is sourced from the foreground layer,there is a corresponding hole at the same location in the backgroundlayer. Such holes or don't care pixels are irrelevant to thereconstruction, but can have a significant affect on compressiondepending upon their values. Given that the values are irrelevant toreconstruction, they may be modified to achieve more efficientcompression.

Block 230 must analyze a stripe to determine the followinginformation: 1) offsets and sizes of coded foreground and backgroundlayers, 2) foreground and background base colors, 3) full resolutionmask, 4) interpolation values for the don't care pixels in theforeground and background layers (i.e., JPEG matched interpolation), 5)JPEG parameters for the foreground and background layers, and 6) JBIGparameters for the mask layer.

FIG. 4 illustrates one embodiment of an MRC coder process including thestripe analysis process. The MRC coder process is operating on stripesof the striped compound document. Step 410 determines whether there areany more stripes to process. If not, then the process is complete instep 490. Otherwise step 420 obtains a stripe for analysis. The stripeanalysis portion 430 may be conceptually subdivided into threecomponents. In step 440, the layer offsets, sizes, and base colors aredetermined. Step 450 performs a coder matched layer separation. In theillustrated embodiment, this is a JPEG matched layer separation. Step460 then interpolates the irrelevant don't care pixels to facilitateJPEG compression. The image (foreground and background) layers are JPEGcoded and the mask layer is JBIG coded in step 470. The processcontinues until all stripes have been processed.

The goal of the first step of the stripe analysis process is to reducethe coded size of the image layers through appropriate selection of basecolors and layer sizes and offsets. If a compound document has marginsof constant colors, for example, such information can be moreeconomically conveyed through the use of offset and base colorparameters as opposed to JPEG encoding. The first step can be furthersubdivided into the functions of perimeter finding and common areareduction. The functions may be performed substantially simultaneously.

The perimeter finding function attempts to find the thickest marginsalong the edges of a strip that consists of only two colors so that theresidual coded region in the image layers are minimized. A systematicanalysis of stripe rows and columns is performed for this function.

FIG. 5 illustrates the perimeter finding function. Step 510 selects anedge to start with given the set {top, bottom, left, right}. All fourwill eventually be processed so any edge may be selected initially. Forpurposes of example, the top edge is presumed the initial selected edge.

A scan is performed on the stripe beginning with the selected edge andproceeding to the edge opposite the selected edge as indicated by step520. The scan continues until encountering more than two distinctcolors. The first two distinct colors become the candidate base colorpair. If, for example, the top edge is initially selected row scansbeginning at the top edge and proceeding toward the bottom edge areperformed until encountering a third color. This marks the firstboundary.

Proceeding anticlockwise, another edge is selected in step 522. If thetop edge was initially selected, the next edge is the left edge in oneembodiment. Scanning is performed beginning with the new edge andproceeding toward its opposite edge in step 530. If the left edge isselected, scanning proceeds along columns until encountering a colorthat is not a member of the candidate base color pair. This marks thesecond boundary.

Proceeding anticlockwise, a third edge is selected in step 532. If thetop edge was initially selected, the third edge is the bottom edge inone embodiment. Scanning is performed beginning with the third edge andproceeding toward its opposite edge in step 540 until encountering acolor that is not a member of the candidate base color pair. This marksthe third boundary.

Proceeding anticlockwise, a fourth edge is selected in step 542. If thetop edge was initially selected, the fourth edge is the right edge inone embodiment. Scanning is performed beginning with the fourth edge andproceeding toward its opposite edge in step 550 until encountering acolor that is not a member of the candidate base color pair. This marksthe fourth boundary.

Based on the boundaries obtained through scanning, foreground andbackground layer offsets and sizes can be determined in step 552. One ofthe two colors of the candidate base color pair is assigned to theforeground base color while the other member of the pair is assigned tothe background base color.

The information obtained so far represents only one candidate pair ofbase colors and associated offsets. This solution may not be optimal.For example, a different initial scan edge may result in a differentcandidate base color pair and associated offsets that produce a smallercoded region. Accordingly, step 560 ensures that the process is repeateduntil a candidate base color pair and associated offsets are determinedfor each possible starting edge.

After each edge of the stripe has been a starting edge there will befour candidate base color pairs with associated offsets. Thus after allpossible starting edges have been processed as determined by step 560,step 570 selects the candidate base color pair (and associated offsets)that result in the smallest coded regions.

At this point, the foreground and background layers are the same sizeand have the same offsets resulting in a common area for the foregroundand background layers. The common area reduction function attempts toreduce the size of the coded foreground or background layer beyond thecommon area.

Generally, the common area is columnwise scanned from one edge towardsthe opposing edge. The fraction of pixels having the base color of theselected layer is tabulated for each column. This value is compared witha threshold, T_(F) typically set to 0.75. A variable N_(F) is a functionof the document resolution. In one embodiment, N_(F) is selected tocorrespond to the number of columns required for a 0.25 inches width. Assoon as a contiguous run of N_(F) columns where the fraction of pixelshaving the selected layer base color falls below T_(F), the scan isstopped and the background layer is adjusted to start at the beginningof the run.

FIG. 6 illustrates one embodiment of the common area reduction function.In step 610, threshold variables T_(F) and N_(F) are initialized. T_(F)is a pixel threshold and is set to 0.75 in one embodiment. N_(F)represents a number of contiguous rows or columns threshold and is afunction of the document resolution. In one embodiment, N_(F) isinitialized to a value corresponding to approximately 0.25 inches.

In step 612, a layer is selected for common area reduction. In oneembodiment, the common area reduction function begins with thebackground layer. In step 614, a starting edge of the stripe isselected. In one embodiment, the starting edge is selected from one ofthe left and right edges.

In step 620 a number of columns variable, NCOL, is set to zero. Step 630scans a column to identify a fraction of pixels, P_(F), having the basecolor associated with the selected layer. If P_(F)<T_(F) (e.g., lessthan 75% of the pixels are associated with the background base color),then NCOL is incremented in step 640, otherwise NCOL is set to zero instep 634. Step 642 determines whether NCOL=N_(F) thus determiningwhether there are at least N_(F) contiguous columns for whichP_(F)<T_(F).

If not, then step 660 checks whether there are additional columns to beprocessed. If so, step 662 selects the next column and the processcontinues with step 620 using the new column.

If so, then step 650 reduces the coded area of the selected layer byN_(F) columns. This effectively decreases the amount of common arearequired for coding the selected layer. Accordingly, the mask value inthe discarded portion of the common area is set to the value associatedwith the selected layer in step 652. For a mask convention of0-background and 1-foreground, in the area discarded from the backgroundlayer, the mask value is assigned to 0 (background) for all pixelshaving the background color, and 1 otherwise. Step 660 then determineswhether there are any more columns to process.

If step 660 determines that there are no more columns to process in thecommon area, step 670 determines if there is another starting edge toprocess. If not, then the process is completed in step 690. Otherwise,the next edge is selected for processing in step 672 and the processrepeats from step 620 with the new edge.

Once the common area reduction of FIG. 6 has been performed for onelayer (e.g., background), the process may be repeated for the otherlayer (e.g., foreground). The foreground and background layers, however,cannot both be reduced from the same sides. Thus if the background layerhas been reduced from the left edge of the common area, the foregroundcannot be reduced from the left edge. The foreground, however, may bereduced from the right edge if no reduction from the right haspreviously been made for the background layer. Thus scans for one orboth edges of one layer can be skipped entirely. Thus it is necessary toidentify the edges for which reduction for a selected layer issuccessful to eliminate attempting such reduction for the same edges forthe next layer.

In one embodiment, the perimeter and common area reduction functions areperformed substantially concurrently. Even if a first candidate basecolor pair yields a larger common area than a second base color pair,the first candidate base color pair may yield a smaller sum offoreground and background layer sizes after common area reduction.Performing perimeter finding and common area reduction functionsconcurrently enables one to see if any or both of the layers can befurther reduced immediately after identifying a pair of candidatecolors. Of the four possible candidate pairs, the one that yields thesmallest sum of areas of the background and foreground layers is chosen.

The mask values are now assigned based on the results of the analysis.In one embodiment, the lighter (i.e., higher luminance) color of thebase color pair is considered the background base color while the darkercolor is considered to be the foreground base color. The mask is thenassigned a 0 or a 1 depending on whether the color of the pixel is thebackground base color or the foreground base color, respectively.Moreover, if the layers were reduced beyond the common area, the maskvalues are assigned accordingly (see step 652). For example, if theforeground layer has been reduced, the mask in the discarded region isassigned so that pixels with the foreground base color are assigned 1while all other pixels are assigned 0. Thus after processing bothlayers, the mask values for all pixels other than those comprising theintersection of the foreground and background layers has beendetermined. The result is that the foreground, background, and maskvalues for all regions of the stripe except the portion represented byoverlapped common reduced areas have been determined.

FIG. 7 illustrates a stripe 710 with common area 712 before common areareduction. The stripe is decomposed into foreground layer 720 withreduced common area 722 and background layer 730 with reduced commonarea 732. The foreground reduced common area is the same as the commonarea 712 before reduction. The background reduced common area 732,however, is smaller in size indicating that common area reduction wassuccessful for the background layer. Mask values have now been assignedto all areas except the intersection of the foreground and backgroundcommon reduced areas. In the illustrated example, the intersection ofthe two is actually the background common area 732.

In one embodiment, the boundary of the reduced common area is adjustedto ensure that it facilitates efficient coder operation. For a JPEGcoder, the boundary of the reduced common area is adjusted to ensurethat it is 8N pixels from the left edge of the common area 712 beforereduction, wherein N is an integer (i.e., 0, 1, 2. . . ). Thus theintersection of the two areas is designed to be a multiple of 8N pixelsfrom the left edge of the area to be coded. In this case, the left edgeof the background common reduced area is adjusted to ensure that it is amultiple of 8N pixels from the left edge of the foreground commonreduced area.

Referring to FIG. 4, after the stripe analysis block 430 has identifiedthe base colors and offsets (step 440), a coder matched layer separationis performed (step 450). FIGS. 8–9 illustrate the coder matched layerseparation process. In one embodiment, the coder matched layerseparation attempts to decompose the region of intersection into twoseparate layers that code more efficiently than the area of intersectionitself.

Edges inside of JPEG coded blocks yield high coded rates. The coded rateis smaller, however, if the edges are moved to block boundaries. Thushigh differentially coded DC values caused by jumps in DC values insuccessive blocks are more efficiently coded than high AC coefficientscaused by edges inside the block.

Generally the coder matched layer separation processes blocks of pixelsin the area of intersection in the coder scan order. Thus for JPEGcoders, the blocks are processed in row scan order. Within each blockthere are three possible layer combinations. Each block may consistof 1) pixels that belong exclusively to the foreground layer; 2) pixelsthat belong exclusively to the background layer; or 3) some pixelsbelonging to the foreground layer and other pixels belonging to thebackground layer.

If the block is of sufficiently low variance, it is assigned entirely tothe foreground or background layer depending upon whether its pixels arecloser to the DC value of the previous coded foreground block or theprevious coded background block. For a high contrast block, the pixelsare separated into two groups. In one embodiment, the lighter group isalways assigned to the background layer while the darker color isassigned to the foreground layer. The mask values are assignedaccordingly.

FIGS. 8–9 illustrate the coder matched layer separation process that isapplied to the region of intersection or overlapped common reducedareas. Step 802 initializes the DC values for the interpolatedforeground and background blocks. (Interpolation is discussed withrespect to block 460.) The variables PREV_AVG_FG and PREV_AVG_BG arevectors representing the average values for each color plane of theprevious interpolated coded foreground and background blocks,respectively. These vectors are initialized to the appropriate layerbase colors in step 802.

In step 810 a block of pixels is selected from the region ofintersection. In step 812, the value RMAX is calculated. For an image inRGB color space, RMAX is a scalar value corresponding to the maximum ofthe ranges of the R, G, and B components found in the selected block. IfRMAX is greater than a pre-determined threshold, TMAX, as determined bystep 814 (i.e., RMAX>TMAX), then some pixels will be assigned to theforeground and other pixels will be assigned to the background asdetermined by steps 820–852. Otherwise, if RMAX≦TMAX then the entireblock will be assigned to either the background or the foreground layerbased on an average luminance value in the block as determined by steps910–942 of FIG. 9.

If RMAX>TMAX, the pixels are separated into two groups. In oneembodiment, a 2 means algorithm is used to separate the pixels into twogroups, GROUP_(—)1 and GROUP_(—)2. The average for each group, AVG_(—)1and AVG_(—)2 is then calculated in step 830. AVG_(—)1 and AVG_(—)2 arevectors whose elements represent the average pixel value of theassociated color plane for GROUP_(—)1 and GROUP_(—)2, respectively.

The average luminances for the groups of pixels are compared in step832. In one embodiment, the darker group is assigned to the foregroundand the lighter group is assigned to the background.

Thus, if the average luminance of GROUP_(—)1 is greater than the averageluminance of GROUP_(—)2 as determined by step 832, then GROUP_(—)1 isassigned to the background and GROUP_(—)2 is assigned to the foregroundin step 840. The components of vector variable PREV_AVG_BG are assignedthe average value for the associated color plane for the pixels inGROUP_(—)1 (i.e., PREV_AVG_BG=AVG_(—)1).

Similarly, the components of vector variable PREV_AVG_FG are assignedthe average value for the associated color plane of the pixels inGROUP_(—)2 (i.e., PREV_AVG_FG=AVG_(—)2).

Alternatively, if the average luminance of GROUP_(—)1 is not greaterthan the average luminance of GROUP_(—)2, then GROUP_(—)1 is assigned tothe foreground and GROUP_(—)2 is assigned to the background in step 850.The variables PREV_AVG_BG and PREV_AVG_FG are respectively assigned theaverage value for the pixels in GROUP_(—)2 and GROUP_(—)1(PREV_AVG_BG=AVG_(—)2 and PREV_AVG_FG=AVG_(—)1).

After the pixels have been assigned to the appropriate layer, step 860determines if there are any blocks remaining to be processed. If so, theprocess continues with another block in step 810. Otherwise, the processis completed in step 890.

In the event RMAX≦TMAX, then the block average, B_AVG, is computed instep 910 of FIG. 9 after step 814 of FIG. 8. The elements of vectorB_AVG represent the average of each color plane of the image. Theaverage block luminance is computed in step 920. Depending upon whetherthe average block luminance value is closer to the average luminance ofthe previous background or the previous foreground, the entire block isassigned to the background or foreground. Thus if the average luminanceof the selected block is closer to the average luminance of the previousbackground, the block is assigned to the background in step 930 and thevector PREV_AVG_BG is set to B_AVG in step 932.

If, however, the average luminance of the selected block is closer tothe average luminance of the previous foreground, the block is assignedto the foreground in step 940 and the vector PREV_AVG_FG is set to B_AVGin step 942.

Once the entire block has been assigned to either the foreground or thebackground layer, step 860 determines whether there are more blocks toprocess. If so, processing continues with step 810. If not, the processis completed in step 890.

Referring to FIG. 4, after the coder matched layer separation takesplace in step 450, the layers are interpolated in step 460. The purposeof layer interpolation is to fill up the “holes” produced in thebackground and foreground layers when pixels are assigned to the otherlayer with values that result in efficient encoding. For each imagelayer 8×8 blocks are scanned in row-column order and interpolated tofill in the holes.

Although the value of these holes are irrelevant to the reconstructionof the image (they are masked out), the value assigned to thecorresponding pixels may have significant impact on the blockcompression rate. Accordingly, the values of these “hole” or “don'tcare” pixels are modified in order to achieve greater compressionefficiencies. This approach will not affect the reproduction quality anddoes not require modification of the decoding algorithm. The don't carepixels are alternatively referred to as “irrelevant” or “modifiable”pixels. The remaining pixels are referred to as “relevant” or“nonmodifiable” pixels.

As noted previously, each block of the stripe may consist of 1) pixelsthat belong exclusively to the foreground layer; 2) pixels that belongexclusively to the background layer; or 3) some pixels belonging to theforeground layer and other pixels belonging to the background layer. Fora selected image layer, this implies that a block of the selected imagelayer may consist of 1) relevant pixels exclusively, 2) irrelevantpixels exclusively, or 3) a combination of relevant and irrelevantpixels.

FIG. 10 illustrates how blocks of a selected image layer of a stripe areselected for interpolation. An image layer is selected in step 1002 fromthe set {foreground, background}. A variable PREV_AVG is initialized toeither the background or foreground base color in step 1004 dependingupon the corresponding selected layer. A block of pixels for theselected layer is selected in step 1010. The pixels are classified asrelevant or irrelevant in step 1020. The mask layer inherentlyclassifies pixels as relevant or irrelevant for a given image layer.

If the selected block contains a mix of relevant and irrelevant pixelsas determined by step 1030, then the block is interpolated as indicatedby step 1050. If the selected block consists entirely of irrelevantpixels as determined by step 1040, then the pixel values are set to apre-determined value in step 1060. In one embodiment, the pre-determinedvalue is PREV_AVG which is initially set to the foreground or backgroundcolor depending upon the associated layer being processed. If the blockotherwise consists entirely of relevant pixels, then no interpolation isperformed.

After steps 1050 or 1040, the PREV_AVG is updated with the averagevalues of the relevant pixels in the selected block in step 1062. Noupdate is required if the selected block initially consisted entirely ofirrelevant pixels. After PREV_AVG has been updated, if necessary, step1070 determines if the selected layer has additional blocks to beprocessed. If so, the process returns to step 1010 to repeat itself witha new block.

In one embodiment the interpolation of step 1050 assigns the irrelevantpixels the average value of the relevant pixels in the selected block.This interpolation procedure tends to be considerably faster than thesubsequently discussed interpolation procedure, but may not achieve thesame rate of compression.

In an alternative embodiment, the interpolation process of step 1050 isconsiderably more complex but frequently results in greater compressionrate than the simpler and faster averaging process. In order tounderstand this alternative interpolation process some understanding ofthe coder process is required.

Block compression algorithms are prevalent in image processingapplications. One technique for compressing the digital representationof source image data includes the step of transforming the spatialdomain image data into frequency domain data. Transformation from thespatial domain into the frequency domain is also referred to as aforward transformation.

Forward transformation is analogous to a harmonic analysis of the sourceimage. A forward transform is used to represent the spatial image dataas linear combinations of basis functions. The coefficients for thesebasis functions are determined during the transformation process.

The basis coefficients are then quantized or thresholded to eliminatecontributions from the corresponding basis function to achieve somelevel of compression. The remaining coefficients are then re-ordered orrun-length encoded or otherwise processed to facilitate furthercompression of the image data. The resulting compressed image data isthen available for storing, distribution, or for further processing.

Typically, the greater the number of zero-valued quantized coefficients,the greater the rate of compression. Accordingly, the values of theirrelevant pixels may be modified to decrease the number of non-zeroquantized coefficients. The modifiable pixels are modified so that aquantized forward transform of the modified block has a greater numberof zero values than a quantized forward transform of the selected block.This operation reduces the “rate” of the compressed image, where “rate”is a reference to the storage requirements of the compressed image. Theoperation thus increases the compression efficiency or rate efficiencyof the image encoder.

The manner in which pixels are modified depends upon the specifics ofthe compression algorithm. The Joint Photographic Experts Group and theMotion Picture Experts Group (MPEG) have each promoted popular imagecompression and encoding architectures that manipulate spectral contentto achieve data compression. JPEG compression is frequently used forstatic images such as those encountered in facsimile or standardprinting applications. The MPEG format is used for dynamic images ormovies. The basic process has been promulgated by JPEG and is inwidespread use today. Although JPEG utilizes a Discrete CosineTransformation (DCT), specific implementations of the forward transform,quantization, and entropy encoding blocks is left to the implementer.

FIG. 11 illustrates one embodiment of a block-based process forcompressing an image in greater detail. The image encoder 1120 processesa discretized source image 1110 to produce compressed image data 1190.

Encoder 1120 processes the source image 1110 as a plurality of 8×8source blocks. A forward transformation is performed on each 8×8 sourceblock. Each 8×8 source block is a 64-point discrete signal that is atwo-dimensional spatial function of x and y. The DCT is one of manytransforms that can be used to represent signals as linear combinationsof basis functions. Although the DCT is the selected transform for JPEGcompression, other linear forward transforms such as the Fouriertransform and the Discrete Sine Transform (DST) may be used.

The forward DCT is a harmonic analyzer that converts the 64 pointdiscrete signal into 64 orthogonal basis signals. Each orthogonal basissignal represents a two dimensional spatial frequency forming thespectrum of the 8×8 source block. The output of the forward DCT is acoefficient block identifying the amplitude of each of these orthogonalbasis signals. The amplitudes are referred to as DCT coefficients andthe values are determined by the discrete 64 point input signal.

Referring again to FIG. 11, quantizer 1140 quantizes the DCTcoefficients in accordance with a quantization table 342. Differentquantums can be used with different spatial frequencies as identified byquantization table 1142. The quantized c(u,v) may be calculated asfollows:

${c^{Q}\left( {u,v} \right)} = {{INT}\left( \frac{c\left( {u,v} \right)}{q\left( {u,v} \right)} \right)}$where “INT” is an integer function to ensure the result is an integer.

The quantization table permits different step sizes for different basisfunctions. The quantization table is thus a 64 element table, oneelement for each spatial frequency. Generally, step sizes for higherfrequency basis functions are larger than the step sizes for lowerfrequency basis functions. The step sizes are typically chosen at theperceptual threshold for the visual contribution of the correspondingcosine basis function. The perceptual threshold are functions of thesource image characteristics, display characteristics, viewing distance,etc. Thus the choice of quantization table may be application dependent.

After quantization, entropy encoding is used to efficiently representthe quantized coefficients. Entropy encoder 1150 uses entropy encodingtable 1152 to generate the compressed image data 1190.

Briefly, the number of previous zeros and the bits needed to representthe current quantized coefficient value form a pair. Each pair has itsown code word assigned through a variable length code. Huffman,Shannon-Fano, and arithmetic coding are examples of commonly usedvariable length coders. The more often a given element occurs, thesmaller the number of bits that are used for the corresponding code. TheJPEG encoder outputs the code word for the pair and then a code word forthe current quantized coefficient (also assigned by a variable lengthcoder).

After processing a block of quantized DCT coefficients, the JPEG encoderwrites a unique end of block sequence and then moves to the next block.After finishing all blocks, the JPEG encoder writes an end-of-filemarker. Tables 1152 and 1142 may be incorporated into the compressedimage data to facilitate reconstruction.

The result of quantization is that many of the DCT coefficients havebeen reduced to zero. In particular, coefficients corresponding tohigher frequency cosine basis functions tend to be zero. Orderingquantized DCT coefficients to obtain longer strings of zero-valuedelements improves the rate efficiency of the entropy encoder, particularat the point where any remaining quantized DCT coefficients to beencoded are all zero. Accordingly, the entropy encoder encodes thequantized DCT coefficient block in a zig-zag manner progressing fromquantized coefficients associated with lower frequency basis functionsto the quantized coefficients associated with higher frequency basisfunctions as illustrated in FIG. 12.

The upper left corner of block 1210 corresponds to the DC term (u, v=0).The DC terms are differentially encoded across individual encodedblocks. The remaining AC terms represent higher frequency cosine basisfunctions when progressing towards the lower right corner. The JPEGentropy encoder need only encode up to the highest frequency non-zeroquantized coefficient before writing an end of block. Any othercoefficients are presumed to be zero.

The zig-zag scan order tends to group the number of non-zero elements atone end of the string of elements to be encoded. When the higherfrequency basis coefficients are zero, the zig-zag scan order groups thezero elements at the end of the string of quantized coefficients beingcoded, thus improving the rate efficiency of the entropy encoder. TheJPEG encoder need not encode beyond the last non-zero quantizedcoefficient in the scan order. Given that the higher order frequenciesare likely to be zero, the zig-zag scan order thus increases thecompression efficiency of the JPEG encoder.

The basic spectral manipulation encoding process can be modified topermit modification of pixel values that are irrelevant toreconstruction of the source image, but might have significant effectson rate efficiency.

The 64 pixels in a block are denoted as vector z which is comprised oftwo smaller vectors y and x such thatz ^(T)={y ^(T),x ^(T)}where y y is the set of N_(y) relevant pixels and x is the set of64-N_(y) irrelevant pixels. The 64×64 2D DCT transformation matrix forthe vector is denoted T so that the coefficient set c is given by c=Tz.

One approach might be to solve for the vector x in z that minimizes theenergy of the AC coefficients while leaving the known vector yunaffected. The cost function to be minimized is then given by

$\begin{matrix}{J\left( {\underset{\_}{\left. x \right)} = {\sum\limits_{i = 1}^{63}c_{i}^{2}}} \right.} \\{= {{\underset{\_}{c}}^{2} - c_{0}^{2}}} \\{= {{\underset{\_}{z}}^{2} - c_{0}^{2}}} \\{= {{\underset{\_}{x}}^{2} + {\underset{\_}{y}}^{2} - c_{0}^{2}}} \\{= {{\sum\limits_{i = 0}^{63 - N_{y}}x_{i}^{2}} + {\underset{\_}{y}}^{2} - c_{0}^{2}}}\end{matrix}$

The DC coefficient for 2D DCT is given by:

$\begin{matrix}{c_{0} = {\frac{1}{8}{\sum\limits_{i = 0}^{63}z_{i}}}} \\{= {{\frac{1}{8}{\sum\limits_{i = 0}^{{Ny} - 1}y_{i}}} + {\frac{1}{8}{\sum\limits_{i = 0}^{63 - {Ny}}x_{i}}}}}\end{matrix}$When J(x) is partially derived with respect to each element x_(i) of xand equated to zero, ach element is found to yield the same optimalvalue given by:

$x_{i} = {\frac{1}{N_{y}}{\sum\limits_{i = 0}^{{Ny} - 1}y_{i}}}$Thus the optimal interpolation for the modifiable pixels in terms ofminimizing energy of AC coefficients is the solution that sets thevalues of all the modifiable pixels to the average of the nonmodifiablepixels. This approach might be a good starting point but it ignores theeffects of differential DC coding and the particulars of the blockcompression algorithm entropy encoder.

The goal is to find z that minimizes the rate by maximizing zero runsalong the reverse zig-zag scanning path while satisfying otherconstraints. For example, any modifiable z_(i) must be assigned a pixelvalue within the realizable range and z_(i) for nonmodifiable pixelsshould not change giving:z _(i)=y_(i) i={0,1, . . . , N_(y)−1}0≦z_(i)≦255 i={Ny, . . . , 63}

Consider the DCT coefficients for the modified block. Some coefficientsare quantized to zero while others are quantized to non-zero values. Thelocations (i.e., indices) of the coefficients that can be quantized tozero form the set I_(zero) such that

$I_{zero} = \left\lfloor {\left. i \middle| {{- \frac{q_{i}}{2}} < c_{i} < \frac{q_{i}}{2}} \right.;{i\mspace{11mu}\varepsilon\mspace{11mu}\left\{ {0,1,\;\ldots\;,63} \right\}}} \right\rfloor$

The coefficients are scanned in reverse zig-zag scan order to find thefirst one, c_(j), that is not quantized to zero. If it is possible to“push” the coefficient to zero without violating the other constraintsthen there is a solution z which satisfies the previous constraints:z_(i)=y_(i) i={0,1, . . . ,N_(y)−1}0≦z_(i)≦255 i={Ny, . . . ,63}as well as the following constraint obtained from the I_(zero) set:

${{{- \frac{q_{i}}{2}} < c_{i}} = {{\underset{\_}{t_{i}^{T}}\underset{\_}{z}} < \frac{q_{i}}{2}}},{i\mspace{11mu}\varepsilon\mspace{11mu} I_{zero}},$(i.e., no zero-quantized coefficient may become non-zero quantized thatalso satisfies the following constraint:

${{- \frac{q_{j}}{2}} < c_{j}} = {{\underset{\_}{t_{j}^{T}}\underset{\_}{z}} < \frac{q_{j}}{2}}$The term t _(i) represents the i^(th) row of DCT matrix T. Each zeroquantization constraint is a linear inequality constraint. The existenceof a feasible solution is a Phase 1 linear programming problem which canbe readily solved using techniques such as the simplex method.Modification of coefficient values will not affect the value of relevantpixels as a result of the equality constraints limiting suchmodifications. Relevant pixels in the selected block will have the samevalue as corresponding pixels in an inverse transform of the modifiedcoefficient block. The inverse transform of the modified coefficientblock is a modified selected block.

If a solution exists, then the index of the new zero quantizedcoefficient is added to the I_(zero) set and z is updated to thefeasible solution. If, c_(j) is not zero quantizable, then the methodproceeds to the next non-zero coefficient proceeding in the reverse zigzag order. The process may be repeated until all non-zero quantizedcoefficients have been tested.

Although the resulting solution satisfies all the constraints, thesolution may not be optimal in the sense of minimizing the energy of thecoefficients. In addition to maximizing the length or number of zeroruns, the energy of the non-zero quantized coefficients should beminimized to reach the lowest rate. The minimum energy solution at eachstage minimizes:

${E\left( \underset{\_}{z} \right)} = {\left( {c_{0} - {\frac{8}{Ny}{\sum\limits_{i = 0}^{N_{y} - 1}y_{i}}}} \right)^{2} + {\sum\limits_{i = 1}^{63}c_{i}^{2}}}$subject to the previously established constraints:

${{{- \frac{q_{1}}{2}} < c_{i}} = {{\underset{\_}{t_{i}^{T}}\underset{\_}{z}} < \frac{q_{i}}{2}}},{i\mspace{11mu}\varepsilon\mspace{11mu} I_{zero}}$z_(l)=y_(l) i={0,1, . . . ,N_(y)−1}0≦z₁≦255 i={Ny, . . . ,63}The dc value is considered differentially with respect to the mean ofthe relevant pixel values. The above problem is a quadratic costfunction subject to a series of linear equality and inequalityconstraints. A quadratic program may be applied to identify a solution.The quadratic solver needs only to be invoked after the successive Phase1 linear programs.

The successive linear programs yield solutions with increasing numbersof zero quantized coefficients which may result in the energy of theremaining DCT coefficients becoming higher than that of the optimalaverage interpolated block. If the energy increases too much, the ratemay increase even if zero runs have been maximized.

To avoid this outcome, the quadratic program may be invoked at eachstage after a feasible solution has been found. In this case, thequadratic program uses a stopping criterion based on the ratio of thecoefficient energies of the newest modified block versus that of theaverage interpolated block. If the energy E of the modified selectedblock exceeds a pre-determined proportion T_(E) (T_(E)>1) of the energyE₀ of the average interpolated block then the optimization is terminatedto avoid leading to a higher rate.

FIG. 13 illustrates the pre-compression optimization process for blockshaving a mix of relevant and irrelevant pixels. The irrelevant pixelsare initialized in step 1310. In one embodiment, the irrelevant pixelsare set to a value corresponding to the average pixel value of therelevant pixels in the selected block. In step 1312, the energy of theselected block (after initialization) is computed as E₀.

In step 1320, a coefficient block is generated by applying a forwardtransform on the selected block. In step 1330, the location of all zeroquantized coefficients is stored in array I_(zero).

Proceeding in the reverse zig-zag order, the location of a selectednon-zero quantized coefficient is identified in step 1340. In step 1350,the value of the selected coefficient is calculated for the current z.

Step 1352 determines whether the selected coefficient is zero quantized.If so, then the location of the coefficient is appended to the I_(zero)set of other zero quantized coefficients in step 1370.

If the selected coefficient is not zero quantized, then step 1354determines whether a feasible solution exists that results in a zeroquantized coefficient subject to the previously identified constraints.In one embodiment, a Phase 1 linear program is used to identify such afeasible solution. In one embodiment, the simplex method is used toidentify feasible solutions. If no feasible solution exists, processingcontinues to step 1380.

If a feasible solution exists, a quadratic program is used to identifythe minimal energy solution for z in step 1360. This new z has anassociated energy, E, which is calculated in step 1362.

Step 1364 determines whether

${\frac{E}{E_{0}} > T_{E}},$where T_(E) is an acceptable threshold value for the proportion of E toE₀. If

$\frac{E}{E_{0}} \leq T_{E}$then the coefficient location is added to the I_(zero) set of other zeroquantized coefficients in step 1370 and processing continues with step1380.

Proceeding from either step 1354 or step 1370, a check is performed instep 1380 to determine whether there are any more coefficients to beprocessed. If not, then the modification process for the coefficientblock is completed in step 1390. Otherwise, the process continues withthe next non-zero quantized coefficient by returning to step 1340.

The optimization process repeats steps 1340–1380 until all non-zeroquantized coefficients have been processed or until the energy of theresult exceeds the pre-determined threshold.

In one embodiment, the process stops the first time a feasible solutioncannot be found regardless of whether additional coefficients remain tobe processed. This approach maximizes the length of the last run onzeroes. The last run has the most significant effect on coded rate forJPEG encoders due to the principle of operation of the entropy encoder.

The method of spectral content manipulation tends 1) to increase thenumber of zero quantized coefficients, and 2) to prioritize increasingthe number of consecutive zero quantized coefficients associated withhigher frequency basis functions. Given the idiosyncrasies of entropyencoders, this enables the JPEG encoder to represent the relevant imageusing less data before issuing an end of block.

Referring back again to FIG. 4, once the layer interpolation has beenperformed, the background, foreground, and mask layer coding isperformed in step 470. In one embodiment, the foreground and backgroundlayers are JPEG coded (see FIG. 11) and the mask layer is JBIG coded.

In the preceding detailed description, the invention is described withreference to specific exemplary embodiments thereof. Variousmodifications and changes may be made thereto without departing from thebroader spirit and scope of the invention as set forth in the claims.The specification and drawings are, accordingly, to be regarded in anillustrative rather than a restrictive sense.

1. A method of decomposing an image comprising: decomposing the imageinto a plurality of stripes; determining a layer base color, a layersize and a layer offset of at least one stripe of the plurality ofstripes; separating the stripe into a foreground layer, a backgroundlayer and a mask layer based on the layer base color and the layeroffset; and interpolating irrelevant pixel values in the foregroundlayer and background layer for coder efficiency, wherein saidinterpolating irrelevant pixel values further comprises: determining thelayer base color and the layer offset to a common reduced area of atleast one layer to identify image and mask layer values for all regionsexcept an overlapped common reduced area; and separating the overlappedcommon reduced area into a foreground layer and a background layer. 2.The method of claim 1 further comprising: encoding the foreground layer,background layer, and mask layer.
 3. The method of claim 2 wherein theforeground layer and background layer are JPEG encoded, wherein the masklayer is JBIG encoded.
 4. The method of claim 1 wherein saidinterpolating irrelevant pixel values further comprises: classifying atleast one pixel within a selected block of a selected layer as relevantor irrelevant; generating a coefficient block representing a forwardtransform of the selected block; and modifying coefficient values togenerate a modified coefficient block subject to a set of pre-determinedconstraints including a constraint that the relevant pixels have a samevalue in an inverse transformation of the modified coefficient block asin the selected block.
 5. The method of claim 4 wherein said modifyingcoefficient values includes: selecting a coefficient from thecoefficient block in a reverse zig-zag order wherein the selectedcoefficient has a non-zero value; and finding a feasible solutionresulting in a zero quantizable selected coefficient subject to thepre-determined constraints.
 6. The method of claim 4 wherein thecoefficient values are modified subject to a constraint that no zeroquantizable coefficient preceding the selected coefficient in thereverse zig-zag order is permitted to become non-zero quantizable. 7.The method of claim 4 wherein values of individual elements of a maskclassify pixels in corresponding positions within the selected block asrelevant or irrelevant.
 8. The method of claim 4 further comprising:providing the modified coefficient block to a block compression process.9. The method of claim 4 wherein said interpolating irrelevant pixelvalues further comprises applying a linear program to identify afeasible solution resulting in a zero-quantizable coefficient subject tothe constraints.
 10. The method of claim 9 further comprising applying aquadratic program to generate a modified selected block having minimalenergy.
 11. The method of claim 9 further comprising terminating furthermodifications to the coefficient block if a ratio of the energy of themodified block to the energy of the initial selected block exceeds apre-determined threshold.
 12. The method of claim 4 wherein the forwardtransform is one of a discrete cosine, a discrete sine, and a discreteFourier transform.
 13. A method of decomposing an image comprising:decomposing the image into a plurality of stripes; decomposing at leastone stripe into foreground and background image layers, and a masklayer; identifying an area of intersection of a common reducedforeground area and a common reduced background areas, wherein theidentifying further comprises: computing a maximum block range for aselected block of the area of intersection; and assigning at least onepixel within the selected block to one of the foreground and backgroundplanes in accordance with whether the average luminance of the selectedblock is closer to a previous average foreground luminance or previousaverage background luminance, respectively, if the maximum block rangeis not greater than a pre-determined threshold; and interpolating anyirrelevant pixel values within the area of intersection for coderefficiency for at least one layer.
 14. The method of claim 13, whereinthe area of intersection is selected to have an edge that is 8N pixelsfrom at least one of an edge of the common reduced foreground area andthe common reduced background area, wherein N is an integer, whereinN≧0.
 15. The method of claim 13, wherein said interpolating anyirrelevant pixel values further comprises: selecting a block of pixels;and classifying at least one pixel with the selected block as irrelevantor relevant.
 16. The method of claim 15, wherein said interpolating anyirrelevant pixel values further comprises: calculating an average valueof at least one relevant pixel within the selected block; and assigningthe average value to at least one irrelevant pixels within the selectedblock.
 17. The method of claim 13, wherein said identifying an area ofintersection further comprises: computing a maximum block range for aselected block of the area of intersection; dividing pixels within theselected block into a plurality of groups; and assigning at least oneselected group to one of the foreground and background planes inaccordance with a relative average luminance value of the selected groupand another group, if the maximum block range exceeds a pre-determinedthreshold.
 18. The method of claim 17, wherein said assigning at leastone selected group further comprises assigning the selected group to thebackground layer and the other group to the foreground layer if anaverage luminance of the selected group is greater than an averageluminance of the other group, wherein the selected group is assigned tothe foreground layer and the other group to the background layer if theaverage luminance of the selected group is not greater than the averageluminance of the other group.